Crypto.EncryptBuffer
This command encrypts a variable length buffer given in the Buffer parameter using the SkipJack algorithm. If KeyIndex is set to 0x00, KeyValue will be used as encryption key. Otherwise, KeyIndex is interpreted as the index of the corresponding entry in the internal key list. KeyIndex = 0x01 denotes configuration value 0x81, KeyIndex = 0x02 denotes configuration value 0x82, etc.
The value returned in the InitialVector variable is necessary for CBC encryption. If large amounts of data must be encrypted, this command has to be called more than once. In this case, the returned InitialVector variable of call i of the command has to be specified as the InitialVector parameter of call i+1.
Properties
- Command code: 0x0202
- Command timeout: 100 ms
- Possible status codes: General status codes, Crypto.CrptErrAuth , Crypto.CrptErrKeyNotFound
Parameters (request frame)
Name | Type/Size | Description | |
---|---|---|---|
KeyIndex | Integer (8 bits) | Index of key to use to encrypt data. KeyIndex must be set to 0x00 if a user-defined key, specified in the KeyValue parameter, should be used for encryption. | |
Optional field, condition: KeyIndex == 0 | |||
KeyValue | Raw data (length 10 Bytes) | If KeyIndex is set to 0x00, this value specifies a user-defined encryption key. | |
InitialVector | Raw data (length 8 Bytes) | Initial vector (IV) used for encryption. | |
Length of Buffer | Integer (8 bits) |
Length of Buffer in bytes |
|
Buffer | Raw data | Data buffer to encrypt. |
Returned values (response frame)
Name | Type/Size | Description |
---|---|---|
NextInitialVector | Raw data (length 8 Bytes) | Initial vector to be used as InitialVector parameter in the next call of this command. |
Length of EncryptedBuffer | Integer (8 bits) |
Length of EncryptedBuffer in bytes |
EncryptedBuffer | Raw data | Buffer after encryption. |